home *** CD-ROM | disk | FTP | other *** search
/ Chip 1996 November / Chip 11-96.iso / workshop / howto / mgr < prev    next >
Text File  |  1996-05-25  |  22KB  |  470 lines

  1.              The MGR Window System HOWTO
  2.               Draft 17 Feb 1994
  3.             Copyright Vincent Broman 1994
  4.           Permission granted to make and distribute
  5.          verbatim (unaltered) copies for any purpose.
  6.  
  7. .0 This HOWTO
  8.  
  9.     .01 Table of Contents
  10.  
  11.     This HOWTO            .0
  12.     What is the MGR window system?    .1
  13.     Installing MGR            .2
  14.     Running MGR            .3
  15.     Programming for MGR        .4
  16.     More Documentation        .5
  17.     Credit for MGR            .6
  18.  
  19.     .02 Archiving
  20.  
  21.     This HOWTO is temporarily archived for anonymous FTP on
  22.     bugs.nosc.mil in pub/Mgr/MGR-HOWTO, and more permanently
  23.     on sunsite.unc.edu in pub/Linux/docs/HOWTO .
  24.  
  25.     .03 Credit for the HOWTO
  26.  
  27.     While Vincent Broman first put together this HOWTO,
  28.     much of the information and text was obtained from FAQs,
  29.     READMEs, etc. written by Stephen Uhler, Michael Haardt,
  30.     and other public-spirited net-persons.
  31.     Email corrections and suggested changes to broman@nosc.mil .
  32.  
  33.     Uhler was the main architect of MGR -- see the Credit section below.
  34.  
  35. .1 What is the MGR window system?
  36.  
  37.     .11 Function
  38.  
  39.     MGR (ManaGeR) is a graphical window system.  The MGR server
  40.     provides a builtin window manager and windowed graphics terminal
  41.     emulation on color and monochrome bitmap displays.  MGR is
  42.     controlled by mousing pop-up menus, by keyboard interaction, and by
  43.     escape sequences written on pseudo-terminals by client software.
  44.  
  45.     MGR provides each client window with: termcap-style terminal
  46.     control functions, graphics primitives such as line and circle
  47.     drawing; facilities for manipulating bitmaps, fonts, icons, and
  48.     pop-up menus; commands to reshape and position windows; and a
  49.     message passing facility enabling client programs to rendezvous
  50.     and exchange messages.  Client programs may ask to be informed
  51.     when a change in the window system occurs, such as a reshaped
  52.     window, a pushed mouse button, or a message sent from another
  53.     client program.  These changes are called events.  MGR notifies a
  54.     client program of an event by sending it an ASCII character string
  55.     in a format specified by the client program.  Existing
  56.     applications can be integrated into the windowing environment
  57.     without modification by having MGR imitate keystrokes in response
  58.     to user defined menu selections or other events.
  59.  
  60.     .12 Requirements
  61.  
  62.     MGR currently runs on Linux, Sun 3/4 workstations with SunOS, and
  63.     Coherent.  Various older versions of MGR run on the Macintosh,
  64.     Atari ST MiNT, Xenix, 386-Minix, DEC 3100, and the 3b1 Unix-pc.
  65.     The programming interface is implemented in C and in ELisp,
  66.     although supporting clients written in other languages is quite
  67.     easy.
  68.  
  69.     Running MGR requires much less in resources than X, or even gcc.
  70.     It does not have the user-base, software repertory, or high-level
  71.     libraries of X or MS-Windows, say, but it is quite elegant
  72.     and approachable.
  73.  
  74.     It has been said that MGR is to X as Unix was to Multics.
  75.  
  76.     .13 How do MGR, X11 and 8.5 compare?
  77.  
  78.         MGR consists of a server with builtin window manager and terminal
  79.     emulator, and clients which run in this terminal emulator and use it
  80.     to communicate with the server.  No resource multiplexing is done.
  81.  
  82.     X11 consists of a server and clients, which usually connect to the
  83.     server using a socket.  All user visible things like terminal
  84.     emulators, window managers etc are done using clients.  No resource
  85.     multiplexing is done.
  86.  
  87.     8.5, the Plan 9 window system, is a resource multiplexer, as each
  88.     process running in a window can access /dev/bitblt, /dev/mouse and
  89.     /dev/kbd in its own namespace.  These are multiplexed to the
  90.     /dev/bitblit, /dev/mouse and /dev/kbd in the namespace of 8.5.
  91.     This approach allows one to run 8.5 in an 8.5 window,
  92.     a very clean design.  8.5 further has an integrated window manager
  93.     and terminal emulator.
  94.  
  95. .2 Installing MGR
  96.  
  97.     The latest version can be FTPed from bugs.nosc.mil:pub/Mgr/62 .
  98.     You can get older MGR sources from ftp.thp.uni-koeln.de[134.95.64.1]
  99.     in pub/linux/mgr, or on [134.95.80.1] in pub/thp/linux/mgr, if you
  100.     can't reach the first site.  Even older versions of this distribution
  101.     from Haardt can be found on tsx-11.mit.edu and elsewhere.  Pre-Linux
  102.     versions of MGR from Uhler and others (prior to Haardt) can be
  103.     found at bellcore.com:pub/mgr, although no one seems to maintain
  104.     things there.  MGR has been through a lot of versions and releases,
  105.     but the current *Linux* version number is 0.62.  This version number
  106.     ought to arrive at 1.0 when 256-color VGA code for Linux appears.
  107.  
  108.     Required tools to build this distribution of MGR are m4 (GNU, or
  109.     perhaps another supporting the -D option), make (GNU, or perhaps
  110.     another supporting include) and *roff for the docs.  Also sh,
  111.     awk, and POSIX install.  Binary distributions have not been assembled
  112.     yet, so you need an ANSI C compiler environment, e.g. gcc + gas.
  113.  
  114.     A Linux installation requires Linux 0.99.10 or better, an HGC,
  115.     EGA, VGA, or SVGA graphics card, and a mouse.  Mouses supported
  116.     are: serial Microsoft mouse, serial MouseSystems 3 and 5 byte
  117.     mouse, serial MMSeries mouse, serial Logitech mouse, PS/2 mouse,
  118.     or a bus mouse.  The VGA 640x480 monochrome graphics mode is
  119.     supported out of the box, as is 640x350 and 640x200.  To run
  120.     800x600, or other modes that your BIOS can initialize and which
  121.     do not require bank-switching, you need to run a small program
  122.     (supplied as src/vgamisc/regs.exe) under DOS to read the VGA registers
  123.     while that mode is set and write a header file which you place in the
  124.     directory src/libbitblit/linux.  Some VGA cards can use 128k
  125.     windows, and these can run higher resolutions.  The Linux code
  126.     does not yet support more than two colors.
  127.  
  128.     Suns with SunOS 4.1.2 and bwtwo, cgthree, or cgsix frame buffers
  129.     are supported.  Coherent installations should refer to the
  130.     README.Coh file in the source distribution.  Porting the
  131.     latest-and-greatest MGR to another POSIX-like system which
  132.     provides select() and pty's and direct access to a bitmapped
  133.     frame-buffer ought to be straightforward, just implementing the
  134.     libbitblit library based on the sunmono or colorport code, say.
  135.     
  136.     If you want to install everything, you need 4.8 MB disk space for
  137.     binaries, fonts, manual pages etc.  The sources are about 2 MB,
  138.     plus object files during compilation.
  139.  
  140.     Normally, /usr/mgr should be either the directory or a link to the
  141.     directory where you install MGR stuff for runtime use.  Typing
  142.     "chdir /usr/mgr; gunzip < whereveryouputit/mgrusr.tgz | tar xvf -"
  143.     and optionally
  144.     "chdir /usr/mgr; gunzip < wherever/morefonts.tgz | tar xvf -"
  145.     will unpack these.  The source can be put anywhere, e.g. typing
  146.     "chdir /usr/src/local/mgr; gunzip < wherever/mgrsrc.tgz | tar xvf -"
  147.     to unpack the sources from bugs.nosc.mil.
  148.  
  149.     The source tree can be compiled from one top-level Makefile which
  150.     invokes lower-level Makefiles, all of which "include" a "Configfile"
  151.     at the top level.  The Configfile is created by an interactive sh
  152.     script named Configure, which runs m4 on a Configfile.m4,
  153.     so you do something like this:
  154.  
  155.     chdir /usr/src/local/mgr
  156.     sh ./Configure
  157.     make first
  158.     make depend
  159.     make install
  160.     make clean
  161.  
  162.     It might be wise, before running make, to eyeball the Configfile
  163.     generated by the Configure script, checking that it looks reasonable.
  164.     (At least one m4 poops out, creating a very short Configfile.
  165.     If this happens, try editing a copy of Configfile.sun or Configfile.lx)
  166.     Several flags in MGRFLAGS can be added/omitted to change some
  167.     optional features in the server, viz:
  168.     -DWHO:        muck utmp file so "who" works
  169.     -DVI        code for clicking the mouse in vi moving the cursor
  170.     -DDEBUG        enable debugging output selectable with -d options.
  171.     -DFASTMOUSE    XOR the mouse track
  172.     -DBUCKEY    for hot-key server commands without mousing
  173.     -DPRIORITY    for priority window scheduling instead of 
  174.             round-robin; the active window gets higher priority
  175.     -DCUT        for cut/paste between windows and a global snarf buffer
  176.     -DALIGN        forces window alignment for fast scrolling (monochr)
  177.     -DKILL        kills windows upon tty i/o errors
  178.     -DSHRINK    use only some of the screen ($MGRSIZE in environment)
  179.     -DNOSTACK    don't permit event stacking 
  180.     -DBELL        really ring the bell
  181.     -DKBD        read mgr input from the sun kbd, instead of stdin.
  182.             This permits redirection of console msgs to a window.
  183.     -DFRACCHAR    fractional character movement for proportional fonts
  184.     -DXMENU        extended menu stuff (experimental)
  185.     -DMOVIE        movie making extension which logs all operations to a
  186.             file for later replay -- not quite working under Linux
  187.         -DEMUMIDMSBUT    Emulate a missing middle mouse button by chording
  188.  
  189.     Not all combinations of these options work on all systems.
  190.  
  191.     If a make complains about the lack of a default_font.h or an
  192.     icon_server.h in the directory src/mgr, then just do a
  193.     "make default_font.h icon_server.h" in that directory.
  194.     C code for the static variables containing icons and fonts
  195.     is generated by a translator from icon and font files.
  196.  
  197.     Not all the clients are compiled and installed by the Makefiles.
  198.     Clients found under src/clients having capitalized names or
  199.     not compiled by the supplied Makefiles may have problems compiling
  200.     and/or running, but they may be interesting to hack on.
  201.     Several screen drivers found under the libbitblit directory are
  202.     of mainly archeological interest. Grave robbing can be profitable.
  203.  
  204.     At some point check that your /etc/termcap and/or terminfo file
  205.     contain entries for MGR terminals such as found in the misc
  206.     directory.  If all your software checks $TERMCAP in the environment,
  207.     this is not needed, as long as you run set_termcap in each window.
  208.  
  209.     MGR works better if run setuid root, because it wants to chown
  210.     ptys and write in the utmp file.  This helps the ify iconifier
  211.     client work better and the event passing mechanism be more secure.
  212.     On Linux, root permissions are required in order to do in/out on the
  213.     screen device.  Otherwise, you decide whether to trust it.
  214.  
  215.     In versions around 0.62 there are troubles on the Sun with using
  216.     the csh as the default shell.  Programs seem to run in a different
  217.     process group than the foreground process group of the window's pty.
  218.     There is no trouble with bash, sh, or rc.  Ideas why?
  219.  
  220. .3 Running MGR
  221.  
  222.     The only file =required= in an MGR installation is the server
  223.     itself.  That would give you terminal emulator windows with shells
  224.     running in them, but no nice clocks, extra fonts, fancy graphics,
  225.     etc.  Depending on options, the server needs about 200K of RAM
  226.     plus dynamic space for windows, bitmaps, etc.
  227.  
  228.     If /usr/mgr/bin is in your PATH, then just type "mgr" to start up.
  229.     When the hatched background and mouse pointer appear, hold down
  230.     the left mouse button, highlight the "new window" menu item, and
  231.     release the button.  Then drag the mouse from corner to corner
  232.     where you want a window to appear.  The window will have your
  233.     default shell running in it.  Hold down the left mouse button over
  234.     an existing window to see another menu for doing things to that
  235.     window.  The menu you saw that pops-up over the empty background
  236.     includes the quit command.  For people with a two button mouse:
  237.     press both buttons together to emulate the missing middle button.
  238.  
  239.     ** When trying to run MGR, if you get:
  240.  
  241.     - can't find the screen
  242.       make sure you have a /dev entry for your display device, e.g. on
  243.       a Sun /dev/bwtwo0.  If not, as root cd to /dev, and type
  244.       "MAKEDEV bwtwo0".  Otherwise, you might need the -S/dev/bwtwo0
  245.       or (on Linux) the -S640x480 command line option when starting mgr.
  246.  
  247.     - Can't find the mouse
  248.       make sure /dev/mouse exists, usually as a symbolic link to the
  249.       real device name for your mouse.  If you haven't permission to
  250.       write in /dev, then something like a -m/dev/cua0 option can be
  251.       given when starting mgr.  Also, make sure you've supplied the
  252.       right mouse protocol choice when you configured mgr.  The mouse
  253.       may speak Microsoft, even if that is not the brand name.
  254.  
  255.     - can't get a pty
  256.       make sure all of /dev/[tp]ty[pq]? are owned by root, mode 666
  257.       and all programs referenced with the "shell" option in your
  258.       .mgrc startup file (if any) exist and are executable.
  259.  
  260.     - none but the default font, make sure MGR is looking in the right
  261.       place for its fonts.  Check the Configfile in the source or
  262.       see whether a -f/usr/mgr/font option to mgr fixes the problem.
  263.  
  264.     - completely hung (not even the mouse track moves)
  265.       login to your machine from another terminal (or rlogin) and kill the
  266.       mgr process.  A buckey-Q key will quit MGR if the keyboard still works.
  267.       Sometimes you can switch to another virtual terminal with an alt-F key
  268.       and kill mgr from there.
  269.  
  270.     .31 Applications not aware of MGR
  271.  
  272.     Any tty-oriented application can be run in an MGR window
  273.     without further ado.  Screen-oriented applications using
  274.     termcap or curses can get the correct number of lines and
  275.     columns by your using shape(1) to reshape the window or using
  276.     set_termcap(1) or set_emacs(1) to obtain the correct termcap.
  277.  
  278.     .32 MGR Applications (clients) distributed with the server
  279.  
  280.     bounce, grav, grid, hilbert, mgreyes, stringart, walk - graphics demos
  281.     browse - an icon browser
  282.     bury - bury this window
  283.     clock - digital display of time of day
  284.     clock2 - analog display of time of day
  285.     close - close this window, iconify
  286.     cmenu - vi menus from C compiler errors
  287.     color - set the foreground and background color for text in this window
  288.     cursor - change appearance of the character cursor
  289.     cut - cut text from this window into the cut buffer
  290.     cycle - display a sequence of icons
  291.     dmgr - crude ditroff previewer
  292.     fade - fade a home movie script from one scene to another
  293.     font - change to a new font in this window
  294.     hpmgr - hp 2621 terminal emulator
  295.     ico - animate an icosahedron or other polyhedron
  296.     iconmail - notification of mail arrival
  297.     iconmsgs - message arrival notification
  298.     ify - iconify and deiconify windows
  299.     loadfont - load a font from the file system
  300.     maze -  a maze game
  301.     mclock - micky mouse clock
  302.     menu - create or select a pop-up menu
  303.     mgr - bellcore window manager and server
  304.     mgrbd - boulder-dash game
  305.     mgrbiff - watch mailbox for mail and notify
  306.     mgrload - graph of system load average
  307.     mgrlock - lock the console
  308.     mgrlogin - graphical login controller
  309.     mgrmag - magnify a part of the screen, optionally dump to file
  310.     mgrmail - notification of mail arrival
  311.     mgrmode - set or clear window modes
  312.     mgrmsgs - message arrival notification
  313.     mgrplot - Unix "plot" graphics filter
  314.     mgrsclock - sandclock
  315.     mgrshowfont - browse through mgr fonts
  316.     mgrsketch - a sketching/drawing program
  317.     mgrview - view mgr bitmap images
  318.     mless - start up less/more in separate window, menu added for less
  319.     mvi - start up vi in a separate window, mouse pointing
  320.     oclose - (old) close a window
  321.     omgrmail - (old) notification of mail arrival
  322.     pbmrawtomgr - convert pbm raw bitmap to mgr bitmap format
  323.     pbmstream - split out a stream of bitmaps
  324.     pbmtoprt - printer output from PBM
  325.     pilot - a bitmap browser
  326.     resetwin - cleanup window state after client crashes messily
  327.     rotate - rotate a bitmap 90 degrees.
  328.     screendump - write graphics screen dump to a bitmap file
  329.     set_console - redirect console messages to this window
  330.     set_termcap, set_emacs - output an appropriate TERMCAP value
  331.     setname - name a window, for messages and iconifying
  332.     shape - reshape this window
  333.     square - square this window
  334.     squeeze - compress mgr bitmap using run-length encoding
  335.     startup - produce a skeleton startup file for current window layout
  336.     texmgr - tex dvi file previewer
  337.     text2font, font2text - convert between mgr font format and text dump
  338.     unsqueeze - uncompress mgr bitmap using run length encoding
  339.     window_print - print an image of a window
  340.     zoom - an icon editor
  341.  
  342.     .33 MGR-aware clients distributed separately, see "SUPPORT" file
  343.  
  344.     chess - frontend to /usr/games/chess
  345.     gnu emacs - editor with lisp/term/mgr.el mouse & menu support
  346.     gnuplot - universal scientific data plotting
  347.     metafont - font design and creation
  348.     origami - folding editor
  349.     pbmplus - portable bitmap format conversions, manipulations
  350.     pgs - ghostscript patch and front end
  351.     plplot - slick scientific data plotting
  352.     ? - a groff PBM driver using Hershey fonts
  353.  
  354. .4 Programming for MGR
  355.  
  356.     The MGR programmers manual, the C language applications interface,
  357.     is found in the doc directory in troff/nroff form.  It covers
  358.     general concepts, the function/macro calls controlling the server,
  359.     a sample application, with an index and glossary.
  360.  
  361.     Porting client code used with older versions of MGR sometimes
  362.     requires the substitution of
  363.     #include <mgr/mgr.h>
  364.     for
  365.     #include <term.h>
  366.     and substituting or redefining BIT_XOR, BIT_AND, et al
  367.     for B_XOR, B_AND, et al in the bitblt operations.
  368.  
  369.     Compiling client code generally requires compiler options like
  370.     -I/usr/mgr/include   -L/usr/mgr/lib -lmgr
  371.     as well as an occasional -DOLDMGR or -DOLDLIBMGR for some dusty decks.
  372.  
  373.     One can get some interactive feel for the MGR server functions by
  374.     reading and experimenting with the mgr.el terminal driver for GNU
  375.     Emacs which implements the MGR interface library in ELisp.
  376.  
  377.     The usual method of inquiring state from the server has the
  378.     potential of stumbling on a race condition if the client also
  379.     expects a large volume of event notifications.  The problem arises
  380.     if an (asynchronous) event notification arrives when a
  381.     (synchronous) inquiry response was expected.  If this arises in
  382.     practice (unusual) then the MGR state inquiry functions would have
  383.     to be integrated with your event handling loop.
  384.  
  385.     The only major drawing function missing from the MGR protocol, it
  386.     seems, is an area fill for areas other than upright rectangles.
  387.     At present, the color palette itself is manipulated by
  388.     programs external to MGR, but version 0.62 has experimental code
  389.     for clients to get MGR to manipulate the color palette.
  390.  
  391.     If you are thinking of hacking on the server, you can find the mouse
  392.     driver in mouse.* and mouse_get.*, the grotty parts of the keyboard
  393.     interface in kbd.c, and the interface to the display in the
  394.     src/libbitblit/linux directory.  The main procedure, much
  395.     initialization, and the top level input loop are in mgr.c, and the
  396.     interpretation of escape sequences is in put_window.c .
  397.  
  398. .5 More documentation
  399.  
  400.     The programmer's manual is essential for concepts.
  401.  
  402.     Nearly all the clients supplied come with a man page which is installed
  403.     into /usr/mgr/man/man1 or man6.
  404.     Other useful man pages are bitblit.3, font.5, and bitmap.5 .
  405.     There is some ambiguity in the docs in distinguishing the
  406.     internal bitmap format found in your frame-buffer and the external
  407.     bitmap format found in files, e.g. icons.
  408.  
  409.     The mgr.1 man page covers command line options, commands in the
  410.     ~/.mgrc startup file, mouse and menu interaction with the server,
  411.     and hot-key shortcuts available on systems with such hot-keys.
  412.  
  413.     Many of the fonts in /usr/mgr/font/* are described to some
  414.     extent in /usr/mgr/font/*.txt, e.g. /usr/mgr/font/FONTDIR.txt
  415.     gives X-style font descriptions for the fonts obtained
  416.     in .bdf format.  Font names end in WxH, where W and H are the
  417.     decimal width and height in pixels of each character box.
  418.  
  419. .6 Credit for MGR
  420.  
  421.     Stephen Uhler, with others working at Bellcore, was the original
  422.     designer and implementer of MGR, so Bellcore has copyrighted much
  423.     of the code and documentation for MGR under the following conditions.
  424.  
  425.     * Permission is granted to copy or use this program, EXCEPT that it
  426.     * may not be sold for profit, the copyright notice must be reproduced
  427.     * on copies, and credit should be given to Bellcore where it is due.
  428.  
  429.     One required showing of the copyright notice is the startup title screen.
  430.  
  431.     Other credits to:
  432.  
  433.     Stephen Hawley for his wonderful icons.
  434.     Tommy Frandsen for the VGA linux library.
  435.     Tom Heller for his Gasblit library.
  436.     Andrew Haylett for the Mouse driver code.
  437.     Dan McCrackin for his gasblit->linux patches.
  438.     Dave Gymer, dgp@cs.nott.ac.uk, for the Startrek effect fix.
  439.     Alex Liu for first releasing a working Linux version of MGR.
  440.     Lars Aronsson (aronsson@lysator.liu.se) for text2font and
  441.     an ISO8859-1 8-bit font.
  442.     Harry Pulley (hcpiv@grumpy.cis.uoguelph.ca,
  443.     hcpiv@snowhite.cis.uoguelph.ca) for the Coherent port.
  444.     Vance Petree & Grant Edwards & Udo Munk for their work on Hercules.
  445.     Udo Munk for his work on serial mouse initialization & select.
  446.     Norman Bartek & Hal Snyder at Mark Williams Co.  for their help
  447.     with some bugs & with Coherent device drivers.
  448.     Extra thanks to Zeyd Ben Halim for lots of helpful patches,
  449.     especially the adaptation of selection.
  450.     Bradley Bosch <brad@lachman.com> for lots of patches from his 3b1
  451.     port, which fix bugs and implement new and desirable features.
  452.     Andrew Morton <applix@runxtsa.runx.oz.au> who first wrote the
  453.     cut-word code.
  454.     Kapil Paranjape <kapil@motive.math.tifr.res.in> for the EGA
  455.     support.
  456.     Michael Haardt for MOVIE support fixes, bug fixes, separation of the
  457.     libbitblit code into output drivers, origami folding of the code.
  458.     Yossi Gil for many fonts.
  459.     Vincent Broman for middle mouse-button emulation, linting, Sun cgsix
  460.     support, VGA colormap acess, and integration of the sunport code
  461.     into Haardt's layering scheme.
  462.  
  463.     All bitmap fonts from any source are strictly public domain in the
  464.     USA.  The 450 fixed-width fonts supplied with MGR were obtained
  465.     from Uhler, the X distribution, Yossi Gil, and elsewhere.
  466.     The Hershey vector fonts and the code for rendering them
  467.     are probably freely redistributable.
  468.  
  469.  
  470.